<template>
	<view class="bg-yellow">
		<u-swiper 
			bgColor="#EDAC2F" 
			:list="swiperItems" 
			:height="swiperHeight" 
			:interval="swiperDuration" 
			keyName="image" 
			@click="onClicked"
			indicator 
			indicatorMode="line" 
			circular 
			radius="0"
		>
		</u-swiper>
	</view>
</template>

<script>
	export default {
		name: "ImgSlide",
		props: {
			asData: {
				type: Object,
				required: true,
			}
		},
		data() {
			return {
				swiperItems: [],
				swiperHeight: 150,
				swiperDuration: 2500,
			};
		},
		computed: {
			count() {
				return (this.asData.list.length > 0)
			}
		},
		created() {
			var data = this.asData.list;
			for (var i = 0; i < data.length; i++) {
				let moder = {
					image: data[i].image,
					opentype: 'click',
					url: '',
					title: data[i].linkType,
					linkType: data[i].linkType,
					linkValue: data[i].linkValue,
				}
				this.swiperItems.push(moder);
			}
			this.swiperHeight = this.asData.height;
			this.swiperDuration = this.asData.duration;
		},
		methods: {
			onClicked: function(e) {
				this.showSliderInfo(this.swiperItems[e].linkType, this.swiperItems[e].linkValue);
			},
		}
	}
</script>